﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;

namespace EdytorWF.Objects
{
    public abstract class SimpleObject : IObject
    {
        public Vector3 Position { get; set; }
        private static int counter = 0;

        public SimpleObject()
        {
            MyMesh = null;
            Device = null;
            CollisionBox = new Engine.BoundingBox();

            TypeName = "_SIMPLE_OBJECT";
            ObjectName = String.Format("SimpleObject{0}", counter);
            ++counter;
            
            Position = new Vector3(0, 0, 0);

            ExtendedMaterials = new List<ExtendedMaterial>();
            Textures = new List<Texture>();
            Materials = new List<Material>();
            MeshFileName = "";
            TextureFileName = "";
        }

        public SimpleObject(Device dev, Vector3 init_pos)
        {
            MyMesh = null;
            CollisionBox = new Engine.BoundingBox();
            Device = dev;
            TypeName = "_SIMPLE_OBJECT";
            ObjectName = String.Format("SimpleObject{0}", counter);
            ++counter;

            Position = new Vector3(init_pos.X, init_pos.Y, init_pos.Z);

            ExtendedMaterials = new List<ExtendedMaterial>();
            Textures = new List<Texture>();
            Materials = new List<Material>();
            MeshFileName = "";
            TextureFileName = "";
        }

        public override void ReloadMesh()
        {
            LoadMesh(MeshFileName);
        }

        public override void ReloadTexture()
        {
            LoadTexture(TextureFileName);
        }

        public override void ReloadObject()
        {
            ReloadMesh();
            ReloadTexture();
        }        
    }
}
